require(['./config'], () => {
    require(['template', 'header', 'footer', 'jquery',], (template) => {
        class Index {
            constructor() {
                this.a()
                this.b()
            }
            a() {
                $.get('http://www.xiongmaoyouxuan.com/api/tabs', resp => {
                    if (resp.code === 200) {
                        let { list } = resp.data
                        list = list.slice(8, 15)
                        $('#tabList').html(template('tabListTp', { list }))
                    }
                })
            }
            b() {
                const id = location.search.slice(4)
                $.get(`http://www.xiongmaoyouxuan.com/api/tab/${id}`, { start: 0 }, resps => {
                    console.log(resps)
                    if (resps.code === 200) {
                        const { cname } = resps.data.category
                        const { list } = resps.data.items
                        $('#remen').html(template('remenhot',{ cname }))
                        $('#note').html(template('notelist',{ cname }))
                        $('#shopList').html(template('rendershoplist',{ list }),)
                    }
                })
            }
        }
        new Index()
    })
})
